const wxCloud = {

	get: (path, data) => {
		wx.cloud.init()
		return wx.cloud.callContainer({
			"config": {
				env: "prod-2g2bj1gc4f2aae18"
			},
			"path": path,
			"header": {
				"X-WX-SERVICE": "fridge",
				"token": uni.$store.state.user.token
			},
			"method": "GET",
			"data": data
		})
	},
	post: (path, data, contentType) => {
		wx.cloud.init()
		return wx.cloud.callContainer({
			"config": {
				env: "prod-2g2bj1gc4f2aae18"
			},
			"path": path,
			"header": {
				"X-WX-SERVICE": "fridge",
				"token": uni.$store.state.user.token,
				"content-type": contentType || 'application/json'
			},
			"method": "POST",
			"data": data
		})
	},
	delete: (path, data) => {
		wx.cloud.init()
		return wx.cloud.callContainer({
			"config": {
				env: "prod-2g2bj1gc4f2aae18"
			},
			"path": path,
			"header": {
				"X-WX-SERVICE": "fridge",
				"token": uni.$store.state.user.token
			},
			"method": "DELETE",
			"data": data
		})
	},
	put: (path, data) => {
		wx.cloud.init()
		return wx.cloud.callContainer({
			"config": {
				env: "prod-2g2bj1gc4f2aae18"
			},
			"path": path,
			header: {
				"X-WX-SERVICE": "fridge",
				"token": uni.$store.state.user.token
			},
			"method": "PUT",
			"data": data
		})
	}
}

export default wxCloud
